﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Script.Services;
using System.Web.Script.Serialization;
using Axis.Dao.Core;
using Axis.BusinessObject.Core;
using PhuLeBooze.Global;

namespace PhuLeBooze.Views.Project.Service
{
    /// <summary>
    /// Summary description for ResponseOptionService
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    [System.Web.Script.Services.ScriptService]
    public class ResponseOptionService : System.Web.Services.WebService
    {
        [WebMethod(EnableSession = true)]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public string GeResponseOptionByQuestionID(int QuestionID)
        {
            CResponseUI UI = new CResponseUI();
            var Map = UI.GetResponseListByQuestionnaire(QuestionID);
            JavaScriptSerializer js = new JavaScriptSerializer();
            string strJSON = js.Serialize(Map);
            return strJSON;
        }

        [WebMethod(EnableSession = true)]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public string GetQuestionareListByContext(int QuestionID, string Context)
        {
            CResponseUI UI = new CResponseUI();
            var Map = UI.GetResponseListByQuestionnaire(QuestionID, Context);
            JavaScriptSerializer js = new JavaScriptSerializer();
            string strJSON = js.Serialize(Map);
            return strJSON;
        }

        [WebMethod(EnableSession = true)]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public string GetQuestionListID(int QuestionID, int ProjectID)
        {
            CQuestionUI UI = new CQuestionUI();
            var Map = UI.GetQuestionareList(QuestionID, ProjectID);
            JavaScriptSerializer js = new JavaScriptSerializer();
            string strJSON = js.Serialize(Map);
            return strJSON;
        }


        [WebMethod(EnableSession = true)]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public string GetQuestionnaireConditionsDetails(int QuestionID, int ProjectID)
        {
            CQuestionPathUI UI = new CQuestionPathUI();
            var Map = UI.GetQuestionnaireConditionsDetails(ProjectID, QuestionID);
            JavaScriptSerializer js = new JavaScriptSerializer();
            string strJSON = js.Serialize(Map);
            return strJSON;
        }

        [WebMethod(EnableSession = true)]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public string GetQuestionnaireConditions(int QuestionID, int ProjectID)
        {
            CQuestionPathUI UI = new CQuestionPathUI();
            var Map = UI.GetQuestionnaireConditions(ProjectID, QuestionID);
            JavaScriptSerializer js = new JavaScriptSerializer();
            string strJSON = js.Serialize(Map);
            return strJSON;
        }

        [WebMethod(EnableSession = true)]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public string GetConditionMethod(string Method)
        {
            CCore core = new CCore();
            string output = new JavaScriptSerializer().Serialize(core.GetListData(Method));
            return output;
        }


    }
}
